Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

accept final slash in declaring a DB's baseurl#49

Open
candeira wants to merge 1 commit intocloudant-labs:masterfrom
candeira:urljoining
Open

accept final slash in declaring a DB's baseurl#49
candeira wants to merge 1 commit intocloudant-labs:masterfrom
candeira:urljoining

Conversation

@candeira
Copy link
Contributor

Before the patch, if the URL for the database ends in a slash:

from cloudant import Account, Database, Document
account = Account("http://localhost:5984/")
response = account.login(USERNAME, PASSWORD)
account.all_dbs().json()

Then the account.all_dbs() request is made to the http://localhost:5984//_all_dbs URI (note double slash after the port number, with result:
``
{u'couchdb': u'Welcome',
u'vendor': {u'name': u'The Apache Software Foundation'},
u'version': u'46cb6a4'}


After the patch, both using a baseurl with a final slash or without makes `account.all_dbs()` request to the correct `http://localhost:5984/_all_dbs` URI, with the resulting good behaviour:

from cloudant import Account, Database, Document
account = Account("http://localhost:5984/")
response = account.login(USERNAME, PASSWORD)
account.all_dbs().json()

[u'_replicator', u'_users', u'hello', u'test']

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant